
function volume_down() {
	callws(data = request_json( cmd="player.volume.down", args = '' ), callback = readresponse_cb, target = null);
}

function volume_up() {
	callws( data = request_json( cmd="player.volume.up", args = '' ), callback = readresponse_cb, target = null);
}

function next_play() {
	callws(data = request_json( cmd="player.play.next", args = '' ), callback = readresponse_cb, target = null);
}

function previous_play() {
	callws( data = request_json( cmd="player.play.previous", args = '' ), callback = readresponse_cb, target = null);
}


function pause_music() {
	var current = getel("current_music");
	callws(  data = request_json( cmd="player.pause", args = '' ), callback = readresponse_cb, target = current );
}

function stop_music() {
	var current = getel("current_music");
	callws(  data = request_json( cmd="player.stop", args = '' ), callback = readresponse_cb, target = current 	);
}

function play_radio(name) {
	var current = getel("current_music");
	callws(  data = request_json( cmd="player.play.radio", args = {'name': name} ), callback = readresponse_cb, target = current );
}

function play_folder(name, random){
	random = typeof random !== 'undefined' ? random : false;
	var current = getel("current_music");
	var music_path = getvalhtml("music_path");
	callws(data = request_json( cmd= "player.play.folder", args = {'name':  music_path+name, 'random': random} ), callback = readresponse_cb, target = current	);
}

function play_file(name){
	var current = getel("current_music");
	var music_path = getvalhtml("music_path");
	callws( data = request_json( cmd="player.play.file", args = {'name':  music_path+name} ), callback = readresponse_cb, target = current);
}

function load_folder(name, withPath){
	withPath = typeof withPath !== 'undefined' ? withPath : true;
	var page_container = getel("page_container");
	var music_path = getvalhtml("music_path");

	if (withPath==true) { var name = music_path+name;  } else { var name = name;  }
	callws( 
			data = request_json( cmd="player.load.folder", args = {'name':  name} ), callback = readresponse_raw_cb, target = page_container
		);
}

function load_page(p){
	var page_container = getel("page_container");

	callws( 
			data = request_json( cmd="player.load.page", args = {'page':  p} ), callback = readresponse_raw_cb, target = page_container
		);
}